package com.zmc.coupon.listener;

import com.lmax.disruptor.WorkHandler;
import com.zmc.common.utils.SpringUtils;
import com.zmc.coupon.infrastructure.bean.vo.CouponHistoryUpdateProducer;
import com.zmc.coupon.infrastructure.service.impl.CouponHistoryServiceImpl;

/**
 * @Author：zmc
 * @Date：2024/12/30 16:15
 */

public class CouponHistoryUpdateConsumer implements WorkHandler<CouponHistoryUpdateProducer> {

    @Override
    public void onEvent(CouponHistoryUpdateProducer couponHistoryUpdateProducer) throws Exception {
        CouponHistoryServiceImpl couponHistoryService = SpringUtils.getBean("couponHistoryService");
        couponHistoryService.updateExpiredByCouponId(couponHistoryUpdateProducer.getCouponId());
    }
}
